using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace SaleManagement.Entity.Mapping
{
    public class ContactMap : EntityTypeConfiguration<Contact>
    {
        public ContactMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.Email)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.Subject)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.ContactContent)
                .IsRequired();

            // Table & Column Mappings
            this.ToTable("Contact");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.Subject).HasColumnName("Subject");
            this.Property(t => t.ContactContent).HasColumnName("ContactContent");
            this.Property(t => t.Status).HasColumnName("Status");
        }
    }
}
